package br.com.opengti.webforum.ws.infra;

import org.hibernate.cfg.Configuration;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author Felipe Balbino <felipe@opengti.com.br>
 * @author Gabriel Cardelli <cardelli@opengti.com.br>
 */
public class GenerateDatabase {
	public static void main(String[] args) {
		
	    Ejb3Configuration cfg = new Ejb3Configuration();  
	      
	    // OBS: default eh o nome de meu persistence-unit no persistence.xml.  
	    // O configure vai procurar o persistence.xml dentro da pasta META-INF que tem que estar no classpath  
	    cfg.configure("eventosImpa", null);  
	    Configuration hbmcfg = cfg.getHibernateConfiguration();  
	              
	    SchemaExport schemaExport = new SchemaExport(hbmcfg);  
	    schemaExport.create(true, true);  
		
	}
}
